
package com.xbongbong.sys.domain.dao;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.sys.domain.entity.RoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author oldVersion
 */
@Repository
@Mapper
public interface RoleDao {

    Integer insert(RoleEntity role);

    Integer update(RoleEntity role);

    Integer deleteByKey(@Param("key") Integer key, @Param("corpid") String corpid);

    RoleEntity getByKey(@Param("key") Integer key, @Param("corpid") String corpid);

    List<RoleEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    void updateBatch(@Param("list") List<RoleEntity> list, @Param("corpid") String corpid);

    void updateBatchPermissions(@Param("list") List<RoleEntity> list, @Param("corpid") String corpid);

    void updateRoleName(@Param("id") Integer id, @Param("corpid") String corpid, @Param("roleName") String roleName);

    /**
     * 获取该表中的最大id，用于资金三期数据迁移
     *
     * @param param
     * @return
     */
    Long getMaxId(@Param("param")Map<String, Object> param);

    /**
     * 批量更新角色表，用于资金三期脚本迁移
     *
     * @param updateList
     */
    void updateBatchAll(@Param("list")List<RoleEntity> updateList);

    /**
     * 批量追加权限
     * @param appendRole
     * @param existRole
     * @param corpidList
     */
    void batchAppendPermissions(@Param("appendRole")String appendRole,@Param("existRole")String existRole,@Param("list")List<String> corpidList);
}